home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / ISFIXED.ASM < prev    next >
Assembly Source File  |  1990-10-22  |  6KB  |  109 lines

  1. ;----------------------------------------------------------------------------
  2. ;  ISFIXED.ASM
  3. ;
  4. ;  by Leonard Zerman
  5. ;
  6. ; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  7. ;----------------------------------------------------------------------------
  8.  
  9.                 PUBLIC  isfixed
  10.                 EXTRN __PARINFO:FAR
  11.                 EXTRN __PARC:FAR
  12.                 EXTRN __RETL:FAR
  13.  
  14. ;----------------------------------------------------------------------------
  15. vect_num1       equ     24h                    ; the int to redirect
  16. dos_int         equ     21h                    ;
  17. toupper         equ     0DFh                   ; force to upper case
  18. ;----------------------------------------------------------------------------
  19. isfixed_text  segment byte public 'CODE'
  20.         assume  cs:isfixed_text
  21. isfixed         proc    far                    ;
  22. ;----------------------------------------------------------------------------
  23. start:          jmp     begin                  ;
  24.                                                ;
  25. old_v_1         dd      ?                      ; storage for old int vector
  26. errorflag       db      0                      ;
  27.                 db      ?                      ; alignment
  28. ;----------------------------------------------------------------------------
  29. crit_handler:   mov     cs:errorflag,1         ;
  30.                 xor     ax,ax                  ;
  31.                 iret                           ;
  32. ;----------------------------------------------------------------------------
  33. begin:          push    bp                     ;
  34.                 mov     bp,sp                  ;
  35.                 xor     ax,ax                  ;
  36.                 mov     cs:errorflag,al        ; 
  37.                 push    ax                     ;
  38.                 call    __PARINFO              ; check for 1 parm
  39.                 add     sp,2                   ;
  40.                 cmp     ax,1                   ;
  41.                 je      check4parm             ;
  42.                 mov     cs:errorflag,1         ;
  43.                 jmp     exit                   ;
  44. check4parm:     mov     ax,1                   ;
  45.                 push    ax
  46.                 call    __PARINFO              ; check for character
  47.                 add     sp,2                   ;
  48.                 cmp     ax,1                   ;
  49.                 je      getvect                ;
  50.                 mov     cs:errorflag,1         ;
  51.                 jmp     exit                   ;
  52. getvect:        push    ds                     ;
  53.                 mov     ah,35h                 ; get vector address
  54.                 mov     al,vect_num1           ; 
  55.                 int     dos_int                ;
  56.                 mov     word ptr old_v_1,bx    ; save old int address
  57.                 mov     word ptr old_v_1[2],es ;
  58. ;----------------------------------------------------------------------------
  59.                 mov     ah,25h                 ; set new pointer
  60.                 mov     al,vect_num1           ; 
  61.                 mov     dx,cs                  ;
  62.                 mov     ds,dx                  ;
  63.                 mov     dx,offset crit_handler ; set pointer IP (CS & DS same)
  64.                 int     dos_int                ;
  65.                 pop     ds                     ;
  66. ;----------------------------------------------------------------------------
  67.                 push    es                     ;
  68.                 push    bx                     ;
  69.                 mov     ax,1                   ;
  70.                 push    ax                     ;
  71.                 call    __PARC                 ;
  72.                 add     sp,2                   ;
  73.                 mov     es,dx                  ;
  74.                 mov     bx,ax                  ;
  75.                 mov     dl,byte ptr es:[bx]    ; Load drive letter
  76.                 pop     bx                     ;
  77.                 pop     es                     ;
  78.                 and     dl,toupper             ;
  79.                 sub     dl,'A'                 ;
  80.                 inc     dl                     ;
  81.                 push    ds                     ;
  82.                 push    bx                     ;
  83.                 mov     ah,1Ch                 ;
  84.                 int     dos_int                ;
  85. ;----------------------------------------------------------------------------
  86.                 cmp     byte ptr ds:[bx],0F8h  ; isfixed true if equal
  87.                 je      resetvec               ; 
  88.                 mov     cs:errorflag,1         ; 
  89. resetvec:       mov     ah,25h                 ; 
  90.                 mov     al,vect_num1           ;
  91.                 mov     dx, word ptr old_v_1   ;
  92.                 mov     ds, word ptr old_v_1[2];
  93.                 int     dos_int                ;
  94. ;----------------------------------------------------------------------------
  95.                 pop     bx                     ;
  96.                 pop     ds                     ;
  97. exit:           xor     ah,ah                  ;
  98.                 mov     al,cs:errorflag        ;
  99.                 xor     ax,1                   ;
  100.                 push    ax                     ;
  101.                 call    __RETL                 ;
  102.                 add     sp,2                   ;
  103.                 pop     bp                     ;
  104.                 retf                           ;
  105. isfixed         endp                           ;
  106. isfixed_text    ends                           ;
  107.                 end  
  108. ;----------------------------------------------------------------------------
  109.